package 洛谷;


import java.util.ArrayList;

import java.util.List;
import java.util.Scanner;

public class 八皇后 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
//		int[][] a = new int[n + 1][n + 1];
//		int[] mark = new int[n + 1];
//		boolean[] select = new boolean[n + 1];
//		for (int i = 1; i <= n; i++) {
//			for (int j = 1; j <= n; j++) {
//				//尝试
//
//				//下一轮
//
//				//回溯
//			}
//		}
        List<List<List<Integer>>> q = nQueens(n);

    }

    static List<List<List<Integer>>> nQueens(int n) {
        List<List<Integer>> state = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            List<Integer> row = new ArrayList<>();
            state.add(row);
        }
        boolean[] cols = new boolean[n];// 记录列
        boolean[] dg = new boolean[2 * n - 1];// 记录对角线
        boolean[] udg = new boolean[2 * n - 1];// 记录反对角线
        List<List<List<Integer>>> res = new ArrayList<>();
        backtrack(0,n,state,res,cols,dg,udg);
        return res;
    }

    static void backtrack(int row, int n, List<List<Integer>> state, List<List<List<Integer>>> res,
                          boolean[] cols, boolean[] diags1, boolean[] diags2) {


    }
}